fix: yoga crash with display:none#57197
Conversation
|
Hi @5ZYSZ3K! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Was able to repro crash, thanks! |
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D108796888. |
Summary: Pull Request resolved: #1976 It fixes this issue: react/react-native#52349 Basically, in some rare cases, having an element with `display:none` style caused the app to crash. It was caused by a stale `hasNewLayout` flag on the hidden view That flag was always set in `computeFlexBasisForChildren` for elements with `display:none` style, but could be never consumed/reset, because of a cache hit or something. Since such elements contribute nothing to the layout sizes, I made the change to actually touch them only during actual layout passes ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL] [FIXED] - Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_) react/react-native#52349 X-link: react/react-native#57197 Test Plan: I created a reproduction repo: https://github.com/5ZYSZ3K/native-tabs-crash-repro, to see the issue And to see, that my change fixes it, you can switch to `patch-yoga` branch there, and install it again (don't forget to install pods with `RCT_USE_PREBUILT_RNCORE=0 RCT_USE_RN_DEP=0` variables) Reviewed By: christophpurrer Differential Revision: D108796888 Pulled By: javache fbshipit-source-id: 455e3ddbec760dbee875c02f0ed6266b9a417e9a
Summary:
It fixes this issue: #52349
Basically, in some rare cases, having an element with
display:nonestyle caused the app to crash.It was caused by a stale
hasNewLayoutflag on the hidden viewThat flag was always set in
computeFlexBasisForChildrenfor elements withdisplay:nonestyle, but could be never consumed/reset, because of a cache hit or something.Since such elements contribute nothing to the layout sizes, I made the change to actually touch them only during actual layout passes
Changelog:
[GENERAL] [FIXED] - Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_) #52349
Test Plan:
I created a reproduction repo: https://github.com/5ZYSZ3K/native-tabs-crash-repro, to see the issue
And to see, that my change fixes it, you can switch to
patch-yogabranch there, and install it again (don't forget to install pods withRCT_USE_PREBUILT_RNCORE=0 RCT_USE_RN_DEP=0variables)